<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>vue测试02</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="app">
    <div>
        <h1>计数器: {{ counter }}</h1>
        <input type="number" name="">
    </div>
    <div>
        <button v-on:click="changeCount">增加</button>
    </div>
</div>

<script type="text/javascript">
    var data = {
        counter: 0
    };
    var vm = new Vue({
        el: "#app",
        data: data,
        methods: {
            changeCount: function (event) {
                console.log(event);
                this.counter++;
            }
        }
    });
</script>
</body>
</html>